package com.aismy.admin.controller;

import com.aismy.admin.entity.EvalRecord;
import com.aismy.admin.entity.Question;
import com.aismy.admin.service.EvalRecordService;
import com.aismy.admin.vo.AiResult;
import com.aismy.admin.vo.EvalRecordVo;
import com.aismy.admin.vo.Result;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.*;

/**
 * @author Aismy
 * @date 2025/03/16
 **/
@RestController
@RequestMapping("/api/admin/scale/record")
@RequiredArgsConstructor
public class ScaleRecordController {
    private final EvalRecordService evalRecordService;

    @GetMapping
    public Result<Page<EvalRecordVo>> page(
            @RequestParam(defaultValue = "1") Integer page,
            @RequestParam(defaultValue = "10") Integer size,
            @RequestParam(required = false) String query) {
        return Result.success(evalRecordService.getRecordPage(page, size, query));
    }

    @GetMapping("/ai/{id}")
    public Result<AiResult> generateAiResult(@PathVariable("id") Long id) {
        return Result.success(evalRecordService.generateAiResult(id));
    }
}
